#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define SIZE 5
void Swap(int* p, int* q) {
	int temp = *p;
	*p = *q;
	*q = temp;
}
void BubbleSort(int arr[]) {
	int i = 0;
	for (i = 0; i < SIZE-1; i++) {
		int j = 0;
		int tag = 1;
		for (j = 0; j < SIZE-1-i; j++) {
			if (arr[j] > arr[j + 1]) {
				Swap(&arr[j], &arr[j + 1]);
				tag = 0;
			}
		}
		if (tag) {
			break;
		}

	}
}

int main() {
	int arr[SIZE] = { 6,3,5,8,2 };
	BubbleSort(arr);
	int i = 0;
	for (i = 0; i < SIZE; i++) {
		printf("%d", arr[i]);
	}
	return 0;
}